'\"
.\" Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" Copyright 2015 Nexenta Systems, Inc. All rights reserved.
.\" Copyright 2022 Oxide Computer Company
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.Dd January 16, 2022
.Dt VFSTAB 5
.Os
.Sh NAME
.Nm vfstab
.Nd table of file system defaults
.Sh DESCRIPTION
The file
.Pa /etc/vfstab
describes defaults for each file system.
The information is stored in a table with the following column headings:
.Bd -literal
device       device       mount      FS      fsck    mount      mount
to mount     to fsck      point      type    pass    at boot    options
.Ed
.Pp
The fields in the table are space-separated and show the resource name
.Pq Fa device to mount ,
the raw device to
.Sy fsck
.Pq Em device to fsck ,
the default mount directory
.Pq Em mount point ,
the name of the file system type
.Pq Em FS type ,
the number used by
.Xr fsck 8
to decide whether to check the file system automatically
.Pq Em fsck pass ,
whether the file system should be mounted automatically by
.Xr mountall 8
.Pq Em mount at boot ,
and the file system mount options
.Pq Em mount options .
See respective mount file system man page below in
.Sx SEE ALSO
for
.Em mount options.
A
.Sq -
is used to indicate no entry in a field.
This may be used when a field does not apply to the resource being mounted.
.Pp
The
.Xr getvfsent 3C
family of routines is used to read
.Pa /etc/vfstab .
There are currently no library routines to automate the writing of
.Pa /etc/vfstab .
.Pp
.Pa /etc/vfstab
can be used to specify swap areas.
An entry so specified,
.Pq which can be a file or a device ,
will automatically be added as a swap area by the
.Pa /sbin/swapadd
script when the system boots.
To specify a swap area, the
.Em device-to-mount
field contains the name of the swap file or device, the
.Em FS-type
is
.Dq swap ,
.Em mount-at-boot
is
.Dq no
and all other fields have no entry.
.Sh EXAMPLES
The following are
.Pa /etc/vfstab
entries for various file system types supported in illumos.
.Pp
.Sy Example 1
NFS and UFS Mounts
.Pp
The following entry invokes NFS to automatically mount the directory
.Pa /usr/local
of the server
.Sy example1
on the client's
.Pa /usr/local
directory with read-only permission:
.Bd -literal -offset indent
example1:/usr/local - /usr/local nfs - yes ro
.Ed
.Pp
The following example assumes a small departmental mail setup, in which clients
mount
.Pa /var/mail
from a server
.Sy mailsvr .
The following entry would be listed in each client's
.Pa /etc/vfstab:
.Bd -literal -offset indent
mailsvr:/var/mail - /var/mail nfs - yes intr,bg
.Ed
.Pp
The following is an example for a UFS file system in which logging is enabled:
.Bd -literal -offset indent
/dev/dsk/c2t10d0s0 /dev/rdsk/c2t10d0s0 /export/local ufs 3 yes logging
.Ed
.Pp
See
.Xr mount_nfs 8
for a description of NFS mount options and
.Xr mount_ufs 8
for a description of UFS options.
.Pp
.Sy Example 2
pcfs Mounts
.Pp
The following example mounts a pcfs file system on a fixed hard disk on an x86
machine:
.Bd -literal -offset indent
/dev/dsk/c1t2d0p0:c - /win98 pcfs - yes -
.Ed
.Pp
The example below mounts a Jaz drive on a SPARC machine.
Normally, the volume management software handles mounting of removable media,
obviating a
.Nm
entry.
Specifying a device that supports removable media in
.Pa /etc/vfstab
with set the mount-at-boot field to
.Dq no
.Pq as shown below
disables the automatic handling of that device.
Such an entry presumes you are not running volume management software.
.Bd -literal -offset indent
/dev/dsk/c1t2d0s2:c - /jaz pcfs - no -
.Ed
.Pp
For removable media on a SPARC machine, the convention for the slice portion of
the disk identifier is to specify
.Sy s2 ,
which stands for the entire medium.
.Pp
For pcfs file systems on x86 machines, note that the disk identifier uses
a
.Sy p
.Pq Sy p0
and a logical drive
.Po
.Sy c ,
in the
.Pa /win98
example above
.Pc
for a pcfs logical drive.
See
.Xr mount_pcfs 8
for syntax for pcfs logical drives and for pcfs-specific mount options.
.Pp
.Sy Example 3
loopback File System Mount
.Pp
The following is an example of mounting a loopback
.Pq lofs
file system:
.Bd -literal
/export/test - /opt/test lofs - yes -
.Ed
See
.Xr lofs 4FS
for an overview of the loopback file system.
.Sh SEE ALSO
.Xr getvfsent 3C ,
.Xr fsck 8 ,
.Xr mount 8 ,
.Xr mount_hsfs 8 ,
.Xr mount_nfs 8 ,
.Xr mount_tmpfs 8 ,
.Xr mount_ufs 8 ,
.Xr swap 8
